package atmgui;

import atm.User;

import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;

/**
 * 查询
 */

public class SearchPanel extends JPanel implements ActionListener {

    JTextField usrTextField=new JFormattedTextField();
    private JButton offbtn=new JButton(new ImageIcon("src/images/buttonOff.jpg"));


    private ATM05 atm05;
    private Font font =new Font("宋体",Font.PLAIN,25);
    private JButton surebtn=new JButton(new ImageIcon("src/images/buttonSure.jpg"));

    public  SearchPanel(ATM05 atm05){
        this.atm05=atm05;
        ArrayList<User> users=atm05.getUsers();


        JLabel label=new JLabel("您的余额为:");
        label.setBounds(100,200,300,50);
        label.setFont(font);//字体大小
        label.setForeground(Color.BLUE);//字体颜色
        //文本框组件


        usrTextField.setBounds(300,200,300,50);

        surebtn.setBounds(250,300,140,50);
        surebtn.addActionListener(this);

        offbtn.setBounds(500,300,140,50);
        offbtn.addActionListener(this);



        this.add(offbtn);
        this.add(surebtn);
        this.add(label);
        this.add(usrTextField);
















        this.atm05=atm05;
        this.setLayout(null);
        this.setOpaque(false);






    }







    public void showBlance(){
        usrTextField.setText(atm05.getLoginUser().getBlance() + "");
    }







    @Override
    public void actionPerformed(ActionEvent e) {

        atm05.showPanel("menu");

    }
}
